{% extends "base.html" %}

{% block title %}
        首页信息
{% endblock %}

{% block content %}

{% load key %}
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<script type="text/javascript">
$(function () {
    $('#container').highcharts({
        chart: {
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false
        },
        title: {
            text: '主机状态汇总图'
        },
        tooltip: {
    	    pointFormat: '{series.name}: <b>{point.y}</b>'
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: true,
                    color: '#000000',
                    connectorColor: '#000000',
                    format: '<b>{point.name}</b>: {point.percentage:.1f} %'
                }
            }
        },
        series: [{
            type: 'pie',
            name: '主机数量',
            data: [
                {
                    name: '正常主机',
                    y: {{ status|key:'okcount' }},
                    color: '#008000'
                },
                {
                    name: '故障主机',
                    y: {{ status|key:'badcount' }},
                    sliced: true,
                    selected: true,
                    color: '#8B0000'
                },
            ]
        }]
    });
});
</script>
{% endblock %}
